﻿using FluentNHibernate.Mapping;
using Noodles.Core.Model;

namespace Noodles.Core.Model.Mappings
{
    public class BlogPostMap : ClassMap<BlogPost>
    {
        public BlogPostMap()
        {
            Id(x => x.BlogID);
            Map(x => x.Title);
            Map(x => x.PageID);
            Map(x => x.CatID);
            Map(x => x.PostData);
            Map(x => x.CreateDate);
            Map(x => x.IsPublic);
            Map(x => x.IsActive);
            Map(x => x.IsCommentable);
            Map(x => x.UpdateDate);
            Map(x => x.UserID);
            Map(x => x.Tags);
            Map(x => x.IsHomePage);
            Map(x => x.Description);
            HasMany(x => x.Comments)
               .KeyColumn("BlogID")
               .Inverse()
               .LazyLoad()
               .Cascade.All();
        }
    }
}
